package com.szeastroc.controller.system;

import com.github.pagehelper.PageInfo;
import com.szeastroc.base.controller.BaseController;
import com.szeastroc.bean.system.SystemRole;
import com.szeastroc.service.system.SystemRoleService;
import com.szeastroc.utils.LayerTableDataUtil;
import com.szeastroc.utils.Result4Ajax;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by jie on 2018/1/9.
 */
@Controller
@RequestMapping("/systemRole")
public class SystemRoleController extends BaseController{

    @Autowired
    SystemRoleService systemRoleService;


    @GetMapping("/index")
    public String index(){
        return "system/system_role.html";
    }

    @PostMapping("/getRoleList")
    @ResponseBody
    public LayerTableDataUtil getUserList(Model model, Integer page, Integer limit){
        PageInfo<SystemRole> pageinfo = systemRoleService.selectPage(page, limit);
        LayerTableDataUtil data = new LayerTableDataUtil(pageinfo.getTotal(),pageinfo.getList());
        return data;
    }

}
